import React from 'react'
import PropTypes from 'prop-types'
import { Table, Badge } from 'antd'
import { formatDate } from "utils";
import moment from 'moment'

class Checked extends React.Component {
    constructor(props) {
        super(props)

        this.state = {

        }
    }
    componentDidMount() {
        const { onSearch, menu, pagination } = this.props
        const params = {
            status: menu,
            page: pagination.current
        }
        onSearch(params)
    }
    showSlider = record => {
        // console.log(record)
        // this.setState({lineData:record})
        const { getSliderDetails,getWorkHistory } = this.props
        getSliderDetails(record)
        getWorkHistory(record)
        $("#sliderDetails").animate({ right: "0" });
    }
    onSliderClose = () => {
        $("#sliderDetails").animate({ right: "-500" });
    }
    render() {
        const { ...applyProps } = this.props
        const columns = [
            {
                title: "档案年度",
                dataIndex: "documentYear",
                key: "documentYear",
            }, {
                title: "公证事项",
                dataIndex: "notarialMatters",
                key: "notarialMatters",
                render: (text, record) => {
					const datas = text.split("#")
					const ary = []
					datas.map((item, i) => {
						ary.push(
							<p>{item}</p>
						)
					})
					return ary
				}
            },
            {
                title: "申请人",
                dataIndex: "applyName",
                key: "applyName",
                render: (text, record) => {
					const datas = text.split("#")
					const ary = []
					datas.map((item, i) => {
						ary.push(
							<p>{item}</p>
						)
					})
					return ary
				}
            },
            {
                title: "收件日期",
                dataIndex: "createdTime",
                key: "createdTime",
                render: (text, record) => {
                    return (
                        <p>
                            {
                                moment(record.createdTime).format("YYYY-MM-DD")
                            }
                        </p>
                    )
                }
            },
            {
                title: "公证日期",
                dataIndex: "notarizationAt",
                key: "notarizationAt",
                render: (text, record) => {
                    return (
                        <p>
                            {
                                moment(record.notarizationAt).format("YYYY-MM-DD")
                            }
                        </p>
                    )
                }
            },
            {
                title: "承办人",
                dataIndex: "contractorUserName",
                key: "contractorUserName",
            },
            {
                title: "建档人",
                dataIndex: "createdUserName",
                key: "createdUserName",
            },
            {
                title: "所属机构",
                dataIndex: "organizationName",
                key: "organizationName",
            },
            // {
            //     title: "申请结果",
            //     key: "status",
            //     dataIndex: "status",
            //     render: (text, record) => {
            //         return (
            //             <div>
            //                 {
            //                     record.status == 0 ?
            //                         <div><Badge status="processing" /><span>申请中</span></div> :
            //                         record.status == 1 ?
            //                             <div><Badge status="success" /><span>同意</span></div> :
            //                             record.status == 2 ?
            //                                 <div><Badge status="error" /><span>拒绝</span></div> :
            //                                 record.status == 3 ?
            //                                     <div><Badge status="default" /><span>失效</span></div> :
            //                                     <div><Badge status="warning" /><span>已打印</span></div>
            //                 }
            //             </div>
            //         )
            //     }
            // },
            {
                title: "操作",
                key: 'operation',
                render: (text, record) => {
                    return (
                        <div>
                            <a style={{ marginLeft: 10 }} onClick={() => this.showSlider(record)}>查看审核详情</a>
                        </div>
                    )
                }
            }
        ];
        return (
            <div>
                <Table columns={columns} {...applyProps} />
            </div>
        )
    }
}

export default Checked